package com.define.commons.query.service.impl;

import com.define.commons.query.core.dao.FastMybatisBaseDao;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 * 根据泛型提供基础CRUD的 BaseServiceImpl
 * 对 CommonMapper 和 FastMybatis 提供的接口进行了整合
 * @Author xiewenlong
 * @Date 2018/10/31 12:49
 */
public class BaseServiceImpl<T, I> extends CommonMapperServiceImpl<T> {

    @Autowired
    private FastMybatisBaseDao<T, I> mapper;

    public int deleteById(I i) {
        return mapper.deleteById(i);
    }

    public int deleteByQuery(com.gitee.fastmybatis.core.query.Query query) {
        return mapper.deleteByQuery(query);
    }

    public int save(T t) {
        return mapper.save(t);
    }

    public int saveIgnoreNull(T t) {
        return mapper.saveIgnoreNull(t);
    }

    public int saveBatch(List<T> list) {
        return mapper.saveBatch(list);
    }

    public int saveMulti(List<T> list) {
        return mapper.saveMulti(list);
    }

    public int saveMultiSet(List<T> list) {
        return mapper.saveMultiSet(list);
    }

    public T getById(I i) {
        return mapper.getById(i);
    }

    public T getByQuery(com.gitee.fastmybatis.core.query.Query query) {
        return mapper.getByQuery(query);
    }

    public T getByColumn(String s, Object o) {
        return mapper.getByColumn(s, o);
    }

    public long getCount(com.gitee.fastmybatis.core.query.Query query) {
        return mapper.getCount(query);
    }

    public List<T> listByColumn(String s, Object o) {
        return mapper.listByColumn(s, o);
    }

    public List<T> list(com.gitee.fastmybatis.core.query.Query query) {
        return mapper.list(query);
    }

    public List<Map<String, Object>> listMap(List<String> list, com.gitee.fastmybatis.core.query.Query query) {
        return mapper.listMap(list, query);
    }

    public int update(T t) {
        return mapper.update(t);
    }

    public int updateIgnoreNull(T t) {
        return mapper.updateIgnoreNull(t);
    }

    public int updateByQuery(Object o, com.gitee.fastmybatis.core.query.Query query) {
        return mapper.updateByQuery(o, query);
    }
}
